<template>
  <div class="sidebar">
    <div class="sidebarbg" v-show="show" @click.stop="hidesidebar"></div>
    <div :class="['sidebarbox',{'show':show}]">
      <div class="topbox">
        <div class="face" :style="logint?'background:url('+face+')':'white'">
          <i class="iconfont icon-gerenzhongxin" v-show="!logint"></i>
        </div>
        <div class="name" @click.stop="showlogin" > <!--  @click.left="checklogin" -->
          {{namecontent}}&nbsp;
          <i class="iconfont icon-you"></i>
        </div>
        <div class="scan">
          <i class="iconfont icon-saoma"></i>
        </div>
      </div>
      <div class="contentbox">
        <div class="vip">
          <div class="top">
            <div class="left">
              <div>开通黑胶VIP</div>
              <div>
                立享超21项特权
                <i class="iconfont icon-you"></i>
              </div>
            </div>
            <div class="right">会员中心</div>
          </div>
          <div class="bottom">
            <p>受邀专享，黑胶VIP低至0.04元/天！</p>
          </div>
        </div>
        <div class="personal">
          <ul class="detail">
            <li v-for="(ele,index) in personalList" :key="index">
              <div class="icon">
                <i :class="['iconfont',ele.icon]"></i>
              </div>
              <div class="detailname">{{ele.content}}</div>
              <div class="jump">
                <i class="iconfont icon-you"></i>
              </div>
            </li>
          </ul>
        </div>
        <div class="minbox">
          <div class="title">音乐服务</div>
          <ul class="detail">
            <li v-for="(ele,index) in musicServeList" :key="index">
              <div class="icon">
                <i :class="['iconfont',ele.icon]"></i>
              </div>
              <div class="detailname">{{ele.content}}</div>
              <div class="jump">
                <i class="iconfont icon-you"></i>
              </div>
            </li>
          </ul>
        </div>
        <div class="minbox">
          <div class="title">其他</div>
          <ul class="detail">
            <li v-for="(ele,index) in othersList" :key="index">
              <div class="icon">
                <i :class="['iconfont',ele.icon]"></i>
              </div>
              <div class="detailname">{{ele.content}}</div>
              <div class="jump">
                <i class="iconfont icon-you"></i>
              </div>
            </li>
          </ul>
        </div>
        <div :class="['minbox',{'falselogin':!logint}]">
          <ul class="detail">
            <li v-for="(ele,index) in lastList" :key="index">
              <div class="icon">
                <i :class="['iconfont',ele.icon]"></i>
              </div>
              <div class="detailname">{{ele.content}}</div>
              <div class="jump">
                <i class="iconfont icon-you"></i>
              </div>
            </li>
          </ul>
        </div>
        <div class="minbox" v-show="logint">
          <div class="out" @click.stop="logout">退出登录</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["show", "nickName", "face", "logint"],
  data() {
    return {
      personalList: [
        {
          icon: "icon-020xinfeng",
          content: "消息中心",
        },
        {
          icon: "icon-qianbao",
          content: "云贝中心",
        },
        {
          icon: "icon-fangfa",
          content: "创作者中心",
        },
      ],
      musicServeList: [
        {
          icon: "icon-menpiao",
          content: "演出",
        },
        {
          icon: "icon-gouwudai",
          content: "商城",
        },
        {
          icon: "icon-icon--",
          content: "口袋彩铃",
        },
        {
          icon: "icon-youxi",
          content: "游戏专区",
        },
      ],
      othersList: [
        {
          icon: "icon-shezhi",
          content: "设置",
        },
        {
          icon: "icon-yejianmoshi",
          content: "夜间模式",
        },
        {
          icon: "icon-dingshi",
          content: "定时关闭",
        },
        {
          icon: "icon-duanxiu",
          content: "个性装扮",
        },
        {
          icon: "icon-24gl-headphones",
          content: "边听边存",
        },
        {
          icon: "icon-liuliang",
          content: "在线听歌免流量",
        },
        {
          icon: "icon-tianjiazijiedian",
          content: "添加siri捷径",
        },
        {
          icon: "icon-jinzhi",
          content: "音乐黑名单",
        },
        {
          icon: "icon-dunpai-",
          content: "青少年模式",
        },
        {
          icon: "icon-naozhong",
          content: "音乐闹钟",
        },
      ],
      lastList: [
        {
          icon: "icon-kefu",
          content: "我的客服",
        },
        {
          icon: "icon-dingdan",
          content: "我的订单",
        },
        {
          icon: "icon-menpiao",
          content: "优惠券",
        },
        {
          icon: "icon-fenxiang",
          content: "分享关于网易云",
        },
        {
          icon: "icon-guanyu",
          content: "关于",
        },
      ],
    };
  },
  methods: {
    checklogin() {
      this.$emit("checkloginson");
    },
    logout() {
      this.$emit("logoutson");
    },
    showlogin() {
      this.$emit("showloginson");
    },
    hidesidebar() {
      this.$emit("hidesidebarson");
    },
  },
  computed: {
    namecontent() {
      return this.nickName == "" ? "立即登录" : this.nickName;
    },
  },
};
</script>

<style lang = "less">
.sidebarbg {
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
}
.sidebarbox {
  overflow-y: scroll;
  /* margin-top: 49px; */
  width: 84%;
  height: 100vh;
  position: fixed;
  left: -84%;
  top: 0;
  z-index: 1000;
  transition: all 0.3s ease-in-out;
  &.show {
    left: 0;
    &::before {
      left: 0;
    }
  }
  &::before {
    transition: all 0.3s ease-in-out;
    content: " ";
    width: 84%;
    height: 100%;
    z-index: -1;
    top: 0;
    right: 0;
    bottom: 0;
    left: -84%;
    position: fixed;
    filter: blur(1.2px);
    background: url(../assets/imgs/bg.jpg) rgba(0, 0, 0, 0.3) center 0 no-repeat;
    background-blend-mode: multiply;
    background-size: cover;
  }
  .topbox {
    display: flex;
    align-items: center;
    padding: 49px 15px 0 15px;
    height: 38px;
    line-height: 38px;
    color: white;
    .face {
      background-size: cover !important;
      margin-right: 9px;
      background-color: white;
      width: 26px;
      height: 26px;
      border-radius: 50%;
      overflow: hidden;
      position: relative;
      flex: 0 0 26px;
      i {
        position: absolute;
        bottom: 2px;
        left: 50%;
        transform: translateX(-50%);
        width: 25px;
        height: 25px;
        font-size: 25px;
        color: #f3d7d3;
      }
    }
    .name {
      flex: 1;
      font-size: 14px;
      i {
        font-size: 14px;
      }
    }
    .scan {
      flex: 0 0 21px;
      i {
        font-size: 21px;
        width: 21px;
        height: 21px;
      }
    }
  }
  .contentbox {
    padding: 0 15px;
    .vip {
      letter-spacing: 1px;
      font-size: 11px;
      font-weight: lighter;
      color: #e7d8d79d;
      width: 100%;
      border-radius: 16px;
      background: linear-gradient(to right bottom, #2b2b2b, #444);
      padding: 15px;
      box-sizing: border-box;
      .top {
        display: flex;
        justify-content: space-between;
        padding-bottom: 13px;
        border-bottom: 1px solid #e7d8d723;
        .left {
          div {
            &:nth-child(1) {
              font-weight: normal;
              font-size: 14px;
              color: #e7d8d7;
            }
          }
        }
        .right {
          width: 64px;
          height: 24px;
          line-height: 24px;
          text-align: center;
          border: 1px solid #e7d8d7;
          border-radius: 100px;
          color: #e7d8d7;
        }
      }
      .bottom {
        margin-top: 12px;
      }
    }
    .personal {
      margin-top: 16px;
      letter-spacing: 1px;
      font-size: 15px;
      width: 100%;
      border-radius: 16px;
      background: rgba(255, 255, 255, 0.05);
      padding: 0 15px;
      box-sizing: border-box;
      .detail {
        li {
          display: flex;
          height: 48px;
          align-items: center;
          color: #efefef;
          .icon {
            flex: 0 0 17px;
            margin-right: 10px;
            i {
              font-size: 17px;
            }
          }
          .detailname {
            flex: 1;
          }
          .jump {
            flex: 0 0 14px;
            i {
              color: rgba(255, 255, 255, 0.3);
              font-size: 14px;
            }
          }
        }
      }
    }
    .minbox {
      margin-top: 16px;
      letter-spacing: 1px;
      font-size: 15px;
      width: 100%;
      border-radius: 12px;
      background: rgba(255, 255, 255, 0.05);
      box-sizing: border-box;
      &.falselogin {
        margin-bottom: 16px;
      }
      .out {
        text-align: center;
        height: 50px;
        line-height: 50px;
        color: rgba(255, 255, 255, 0.6);
        font-size: 17px;
        margin-bottom: 30px;
      }
      .title {
        height: 40px;
        line-height: 40px;
        font-size: 12px;
        padding: 0 15px;
        color: rgba(255, 255, 255, 0.5);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
      }
      .detail {
        padding: 0 15px;
        li {
          display: flex;
          height: 48px;
          align-items: center;
          color: #efefef;
          .icon {
            flex: 0 0 17px;
            margin-right: 10px;
            i {
              font-size: 17px;
            }
          }
          .detailname {
            flex: 1;
          }
          .jump {
            flex: 0 0 14px;
            i {
              color: rgba(255, 255, 255, 0.3);
              font-size: 14px;
            }
          }
        }
      }
    }
  }
}
</style>